package pl.edu.agh.neural.core;

import java.util.ArrayList;
import java.util.List;

public class BasicNetwork implements INetwork  {

    protected InputLayer inputLayer;
    protected List<ILayer> layers;

    public BasicNetwork(InputLayer inputLayer, List<? extends ILayer> layers) {
        this.inputLayer = inputLayer;
        this.layers = new ArrayList<>(layers);

    }

    @Override
    public int getInputVectorSize() {
        return inputLayer.getInputVectorSize();
    }

    @Override
    public double[] evaluate(double[] input) {
        inputLayer.setValues(input);

        double[] lastResult = inputLayer.evaluate();
        for (ILayer layer : layers) {
            lastResult = layer.evaluate();
        }

        return lastResult;
    }

    @Override
    public List<ILayer> getLayers() {
        return new ArrayList<>(layers);
    }
}
